﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>文档中心</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm-extend.min.css">
    <link href="/View_Mobile/CSS/animate.css" rel="stylesheet" />


    <style type="text/css">
        .cs-list .list-block .item-inner {
            padding: 0.6em 0;
        }

        .cs-list li.item-content .item-media {
            padding: 0;
        }

        .list-block .item-inner {
            padding-top: 1em;
            padding-bottom: 1em;
        }

        .cz-list {
            font-size: 0.8em;
        }

        .list-block.cs-list .item-subtitle {
            font-size: 0.7em;
        }

            .list-block.cs-list .item-subtitle.item-pic-mesg {
                color: #999;
            }

        .item-pic-mesg .time {
            margin-left: 1em;
        }

        .item-pic-mesg.item-bj .time {
            margin-left: 0;
            color: #06c;
        }

        .item-pic-mesg.item-bj {
            white-space: normal;
            max-height: 3em;
            overflow: hidden;
        }

        .form-checkbox {
            width: 1.1rem;
            height: 1.1rem;
            position: relative;
            border-radius: 1.1rem;
            border: 1px solid #c7c7cc;
            box-sizing: border-box;
        }

        .list-block .item-after {
            color: transparent;
            max-height: none;
        }

        .list-block.cs-list .label-checkbox .item-media {
            padding: 0;
        }

        .list-block.cs-list label.label-checkbox:active {
            background: transparent;
        }

        .click-show {
            background: #000;
            color: #fff;
            z-index: 200;
        }

            .click-show .title {
                color: #f1f1f1;
            }

            .click-show.bar .button-link {
                color: #fff;
            }

        .bar-click-show {
            z-index: 200;
            background: #eaeaea;
            border-top: 1px solid #d6d6d6;
        }

            .bar-click-show.bar-tab .tab-item {
                color: #333;
            }

        .cs-nomarg-nobor {
            border: none;
            margin-top: -1px;
        }

            .cs-nomarg-nobor > ul > li:hover {
                background: #f5f5f5;
            }
        /*加号模块*/
        ul li {
            list-style: none;
        }

        * {
            margin: 0;
            padding: 0;
        }

        #plus_btn {
            height: 3em;
            width: 3em;
        }

            #plus_btn img {
                height: 3em;
                width: 3em;
                position: fixed;
                right: 0.82rem;
                bottom: 4em;
                z-index: 1000;
            }

        .mod-mask {
            position: fixed;
            width: 100%;
            height: 100%;
            background-color: rgba(240,240,240,.9);
            left: 0;
            top: 0;
            z-index: 1001;
        }

        .mod-body {
            min-width: 320px;
            margin-left: auto;
            margin-right: auto;
            max-width: 720px;
            position: relative;
            z-index: 1002;
        }

            .mod-body > ul {
                position: fixed;
                width: 100%;
                right: 0;
                bottom: 3.2em; /*padding: 0.82rem;*/
                right: 0.82rem;
            }

                .mod-body > ul > li {
                    height: 4em;
                    position: relative;
                }

            .mod-body .mod-li-icon {
                display: block;
                height: 3em;
                margin-top: 0.2rem;
                position: absolute;
                right: 0;
            }

        .mod-li-icon img {
            height: 100%;
            width: auto;
        }

        .mod-body .mod-li-tip {
            float: right; /*margin-right: 1rem; */
            height: 1.4rem;
            line-height: 1.4rem;
            margin-top: 0.4rem;
            border-radius: 4px;
            text-align: center; /*width: 8rem;*/
            font-size: 0.6rem;
            color: #858585;
            background-color: #fff;
            box-shadow: 0px 0px 8px #aaa;
            position: absolute;
            right: 20%;
            padding: 0 1em;
            top: 10%;
        }

        #module_plus {
            display: none;
        }

        .address {
            background-color: #d9d8dd;
            padding-bottom: 2.5rem;
        }

            .address .header {
                background-color: #393a3f;
                line-height: 2.2rem;
                color: #fff;
                font-size: 0.4rem;
                position: relative;
            }

        .back {
            position: absolute;
            left: 0.82rem;
            width: 1rem;
            height: 1rem;
            display: block;
            background-size: auto 100%;
            top: 0.6rem;
            background-position: center center;
            background-repeat: no-repeat;
        }

            .back:hover {
                opacity: .7;
            }

        .search-box {
            height: 2.2rem;
            padding: 0.41rem;
        }

            .search-box .inp-s {
                background-color: #fff;
                border-radius: 4px;
                display: block;
                height: 1.38rem;
                width: 100%;
                font-size: 1em;
                border: none;
                background: #fff url(../images/zoom.png) no-repeat 0.82rem center;
                background-size: 0.8rem auto;
                text-align: left;
                padding-left: 2rem;
                line-height: 1.38rem;
            }

        .selected-per {
            height: 3.82rem;
            background-color: #fff;
            padding: 0.41rem;
        }

            .selected-per li {
                width: 15%;
                float: left;
                text-align: center;
                margin-right: 2%;
            }

                .selected-per li:hover {
                    opacity: .7;
                }

                .selected-per li:nth-of-type(6n) {
                    margin-right: 0;
                }

            .selected-per a {
                width: 100%;
                display: block;
                margin-left: auto;
                margin-right: auto;
            }

            .selected-per img {
                width: 100%;
                height: auto;
                margin-left: auto;
                margin-right: auto;
            }

            .selected-per span {
                font-size: 12px;
                display: block;
                margin-top: 0.5em;
                white-space: nowrap;
                color: #898989;
            }

        .sel-title {
            height: 2.58rem;
            margin-top: 0.82rem;
            padding: 0.41rem;
            border-bottom: #cacacc 1px solid;
            background-color: #fff;
            line-height: 2.58rem;
        }

        .sel-btn {
            display: block;
            text-align: center;
            float: left;
            height: 1.60rem;
            line-height: 1.60rem;
            width: 30%;
            border-radius: 4px;
            border: 1px solid #b2b2b2;
            color: #4e4e4e;
            font-size: 1.2em;
        }
        /*.check input[type="check"]*/
        .check {
            position: relative;
            height: 100%;
            line-height: 1.76rem;
            display: inline-block;
            float: right;
            padding-right: 1.2rem;
            color: #4e4e4e;
        }

            .check input[type="checkbox"] {
                display: none;
            }

        .check-icon {
            display: inline-block;
            height: 0.8rem;
            width: 0.8rem;
            background-image: url(../images/uncheck.png);
            background-size: 100% auto;
            position: absolute;
            top: 50%;
            right: 0;
            transform: translate(0,-50%);
            -webkit-transform: translate(0,-50%);
        }

        .check input[type="checkbox"]:checked + .check-icon {
            background-image: url(../images/checked.png);
        }

        .add-lists { /*padding: 0.41rem;*/
            margin-top: 0.82rem;
            background-color: #fff;
        }

        .arr {
            text-indent: -9999rem;
            display: block;
            width: 0.6rem;
            height: 0.6rem;
            background: url(../images/arr-l.png) center center no-repeat;
            background-size: auto 100%;
            position: absolute;
            left: 0.41rem;
            top: 0.83rem; /*transform:translate(0,-50%);*/
        }
        /*.arr-l{ background-image: url(../images/arr-l.png)}*/
        .arr-d {
            background-image: url(../images/arr-d.png);
            background-size: 100% auto;
        }

        .add-li {
            line-height: 2.26rem;
            position: relative;
            background-color: #fff;
        }

            .add-li .check {
                position: absolute;
                right: 0.41rem;
                top: 0;
            }

                .add-li .check .check-icon {
                    top: 0.73rem;
                    transform: none;
                    -webkit-transform: none;
                }

            .add-li a {
                display: block;
                padding-left: 1.5rem;
                color: #4e4e4e;
                height: 2.26rem;
                border-bottom: 1px solid #cacacc;
            }

                .add-li a:hover {
                    background-color: #f7f7f7;
                }

        .sublis .add-li a {
            padding-left: 2.5rem;
        }

        .sublis .add-li .arr {
            left: 1rem;
        }

        .add-count {
            color: #8f8f8f;
            font-size: 0.7em;
            float: right;
            padding-right: 1.5rem;
        }

        .subper a {
            padding-left: 0rem;
        }

        .subper .add-li {
            padding: 0;
        }

            .subper .add-li a {
                height: 2.5rem;
                padding-left: 0.8rem;
                border-bottom: 1px solid #cacacc;
            }

            .subper .add-li .mes-icon, .subper .add-li .mess-r {
                margin-top: 0.4rem;
            }

        .add .footer {
            background-color: #f7f7f7;
            border-top: 1px solid #b0b0b0;
            padding: 0.41rem;
        }

        .add-btn {
            height: 100%;
        }

            .add-btn li {
                height: 100%;
                width: 48%;
                float: left;
            }

                .add-btn li a {
                    display: block;
                    height: 100%;
                    text-align: center;
                    border: 1px solid #c9c9c9;
                    border-radius: 4px;
                    background-color: #fff;
                    height: 1.6rem;
                    line-height: 1.6rem;
                    font-size: 1.4em;
                }

                    .add-btn li a:hover {
                        opacity: .7;
                    }

        .cancel {
            margin-right: 4%;
        }

        .add-btn .ensure a {
            background-color: #33cd31;
            border: none;
            height: 1.66rem;
            line-height: 1.66rem;
            color: #fff;
        }

        .detail-title h1 {
            text-align: left;
            padding-left: 1.5rem;
        }

        .user-block {
            position: relative;
        }

            .user-block .uname {
                width: 2.5rem;
                display: block;
                text-align: center;
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%,-50%);
                -webkit-transform: translate(-50%,-50%);
                color: #fff;
            }

        .uname img {
            width: 100%;
            height: auto;
            margin-bottom: 0.4rem;
        }

        .detail-lis {
            margin-top: 1rem;
            border-top: 1px solid #cccccc;
        }

            .detail-lis li {
                height: 2.3rem;
                line-height: 2.3rem;
                border-bottom: 1px solid #cccccc;
                background-color: #fff;
                padding-left: 0.41rem;
                padding-right: 0.41rem;
            }

                .detail-lis li:hover {
                    background-color: #f7f7f7;
                }

        .label {
            width: 35%;
            display: inline-block;
            font-size: 1.3em;
            color: #484848;
        }

        .detail {
            width: 65%;
            display: inline-block;
            font-size: 0.9em;
            color: #8b8b8b;
        }

        .btn-phone {
            display: block;
            width: 90%;
            border-radius: 4px;
            background-color: #33cd31;
            text-align: center;
            height: 2.3rem;
            line-height: 2.3rem;
            color: #fff;
            font-size: 1.3em;
            margin-left: auto;
            margin-right: auto;
            margin-top: 1.5rem;
        }

            .btn-phone:hover {
                opacity: .7;
            }

            .btn-phone img {
                height: 1rem;
                vertical-align: middle;
            }

        /***头部菜单***/
        #m-horizontalListing {
            overflow: hidden;
            width: auto;
            position: relative;
            z-index: 1;
        }

        .h-listing {
            -webkit-transition: -webkit-transform 300ms ease-in-out;
            -webkit-transform-style: preserve-3d;
            -webkit-backface-visibility: hidden;
            overflow: hidden;
            display: block;
            white-space: nowrap;
            position: relative;
            z-index: 5;
            margin: 0;
            list-style: none;
            padding: 0;
            display: -webkit-box;
            display: -moz-box;
        }

            .h-listing.default {
                width: 9999px;
            }

        .listing {
            display: inline-block;
            padding: 0;
            text-align: center;
            vertical-align: top;
        }

        .listing-thumb-link {
            display: block;
            -webkit-transform: perspective(0) rotateY(0) translateZ(200px);
            text-align: center;
            width: auto;
            -webkit-box-shadow: 0 8px 6px -6px #e0e0e0;
            -moz-box-shadow: 0 8px 6px -6px #e0e0e0;
            box-shadow: 0 8px 6px -6px #e0e0e0;
            -webkit-border-radius: 4px;
            border-radius: 4px;
            padding: 0 1.5em 0 .5em;
            color: #666;
            font-size: .8em;
            height: 2.6em;
            line-height: 2.6em;
            position: relative;
        }

            .listing-thumb-link:after {
                width: 0;
                height: 0;
                border-top: 1.4em solid transparent;
                border-left: 1em solid #eee;
                border-bottom: 1.3em solid transparent;
                display: inline;
                content: "";
                position: absolute;
                right: 5px;
                z-index: 5;
            }

            .listing-thumb-link:before {
                width: 0;
                height: 0;
                border-top: 1.4em solid transparent;
                border-left: 1em solid #d6d6d6;
                border-bottom: 1.3em solid transparent;
                display: inline;
                content: "";
                position: absolute;
                right: 4px;
                z-index: 5;
            }

        .listing-title {
            margin: 0;
            text-align: center;
            font-size: 13px;
            font-weight: 400;
            margin-top: 5px;
            position: relative;
        }


        .h-listing-holder {
            background: #eee;
            overflow: hidden;
            border-bottom: 1px solid #eaeaea;
            position: relative;
            z-index: 100;
        }

        .listing-thumb {
            width: 50px;
        }

        .bar-click-show.bar-tab .menudisabled {
            color: #b7b8b7;
        }
        .ms-controller{visibility:hidden;}
    </style>
</head>
<body ms-controller="UI_QYWD_LISTN" class="ms-controller">
    <div class="page-group">
        <div class="page page-current" id="pageindex1">
            <div class="content" style="padding-bottom:3em;">

                <!-- 点击显示文件夹名 -->
                <div class="h-listing-holder">
                    <ul class="h-listing" id="h-listing">
                        <li class="listing" ms-repeat-item="mapPath">
                            <a ms-attr-href="item.url" class="listing-thumb-link external">
                                {{item.name}}
                            </a>
                        </li>
                    </ul>
                </div>
                <!-- 分类 -->
                <div class="list-block cs-list cs-nomarg-nobor media-list">
                    <!-- 文件 -->
                    <ul>
                        <li ms-repeat-el="wjjData" ms-on-tap="vieww(el)">
                            <div class="item-content">
                                <div class="item-media">
                                    <img src="/View_Mobile/Images/qywd/file1.png" width="50">
                                </div>
                                <div class="item-inner" style="line-height:2.2em">
                                    {{el.Name}}
                                    <span ms-if="type==4" style="display:block;font-size:.65rem;line-height:.6rem;color:#bbbbbb!important">共享来自:{{ComFunJS.convusers(el.CRUser)}}</span>
                                </div>
                            </div>
                        </li>
                        <!-- 视频 -->
                        <li ms-repeat-el="wjData">
                            <div class="item-content">
                                <div class="item-media" ms-click="WJYL(el)">
                                    <img ms-on-click="fdtp(this)" ms-attr-img="{{ComFunJS.getfile(el.ID)}}" class="mall_pcp" ms-attr-id="'wj'+el.ID" style="height:40px;width:40px" ms-if="ComFunJS.xstp(el.FileExtendName)" ms-attr-src="'/ToolS/DownFile.aspx?fileId='+el.ID+'&width=50&height=50'" width="50">
                                    <img ms-if="!ComFunJS.xstp(el.FileExtendName)" ms-attr-src="/View_Mobile/Images/qywd/{{el.FileExtendName}}.png" onerror="javascript: this.src = '/View_Mobile/Images/qywd/file.png'" width="50" />
                                </div>
                                <div class="item-inner">
                                    <div class="item-title-row">
                                        <div class="item-title">{{el.Name}}.{{el.FileExtendName}}</div>
                                    </div>
                                    <div class="item-subtitle item-pic-mesg"><span class="size"> {{ComFunJS.converfilesize(el.FileSize)}}</span><span class="time">{{el.CRDate|date('yyyy-MM-dd HH:mm')}}</span></div>
                                </div>
                                <div class="item-after" style="margin-right:1em;">
                                    <label class="label-checkbox">
                                        <input type="checkbox" name="checkbox" ms-attr-id="el.ID" ms-attr-checked="el.issel" ms-change="LoadMenu(el)">
                                        <div class="item-media"><i class="icon icon-form-checkbox"></i></div>
                                    </label>
                                </div>
                            </div>
                        </li>

                    </ul>

                </div>
            </div>
            <!-- 底部切换 -->
            <nav class="bar bar-tab">
                <a class="tab-item external " ms-class-1="active:type==1" href="/View_Mobile/UI/UI_QYWD_LISTN.html">
                    <span class="icon icon-home"></span>
                    <span class="tab-label">企业知识库</span>
                </a>
                <a class="tab-item external" ms-class-1="active:type==2" href="/View_Mobile/UI/UI_QYWD_LISTN.html?id=2&type=2">
                    <span class="icon icon-me"></span>
                    <span class="tab-label">个人文档</span>
                </a>
                <a class="tab-item external" ms-class-1="active:type==4" href="/View_Mobile/UI/UI_QYWD_LISTN.html?id=4&type=4">
                    <span class="icon icon-share"></span>
                    <span class="tab-label">共享文档</span>
                </a>
                <!--<a class="tab-item external" href="/View_Mobile/UI/UI_QYWD_SC.html">
                    <span class="icon icon-star"></span>
                    <span class="tab-label">我的收藏</span>
                </a>-->
            </nav>

            <!-- 选中按钮显示头部 -->
            <header class="bar bar-nav click-show animated fadeInDown" style="display:none">
                <a class="button button-link button-nav pull-left external" ms-click="hideheader()">
                    <span class="icon icon-left"></span>
                    返回
                </a>
                <!--<a class="button button-link button-nav pull-right checkAll external" ms-click="CheckALL()" style="margin-right:1em">
                    {{model.isQX?"取消全选":"全选"}}
                </a>-->
                <h1 class="title">已选<span>({{model.selWJ.size()}})</span></h1>
            </header>
            <!-- 选中按钮显示底部 -->
            <nav class="bar bar-tab bar-click-show animated fadeInUp" style="display:none;padding:0 2em">
                <a class="tab-item external" ms-click="ShareWJ()">
                    <span class="icon icon-share"></span>
                    <span class="tab-label">分享</span>
                </a>
                <a class="tab-item external  " ms-click="DownLoadFile()">
                    <span class="icon icon-download"></span>
                    <span class="tab-label">下载</span>
                </a>
                <a class="tab-item external active" ms-class-1="menudisabled:selWJ.size()==0||!(ComFunJS.xstp(selWJ[0].FileExtendName)||selWJ[0].FileExtendName.toLowerCase()=='mp4'||(selWJ[0].ISYL=='Y'&&selWJ[0].YLUrl))" ms-click="viewwxx()">
                    <span class="icon icon-star"></span>
                    <span class="tab-label">{{selWJ[0].FileExtendName.toLowerCase()=='mp4'?"播放":"预览"}}</span>
                </a>
                <a class="tab-item external active" ms-if="type==2" ms-click="DelFile()">
                    <span class="icon icon-remove"></span>
                    <span class="tab-label">删除</span>
                </a>
            </nav>
            <span id="plus_btn" ms-if="type==2"><img src="/View_Mobile/images/plus-plus.png" height="188" width="188" alt="" style=""></span>
            <div class="module_plus" id="module_plus">
                <div class="mod-mask"></div>
                <div class="mod-body">
                    <ul>
                        <li style="display:none">
                            <a href="###" class="mod-li-icon"><img src="/View_Mobile/images/c-wjj.png" height="188" width="188" alt=""></a>
                            <div class="mod-li-tip">新建文件夹</div>
                        </li>
                        <li ms-if="type==2">
                            <a href="###" class="mod-li-icon"><img src="/View_Mobile/images/c-wj.png" height="188" width="188" alt=""></a>
                            <div class="mod-li-tip" ms-click="scwj()">上传文件</div>
                            <input type="file" style="display:none;" id="file" onchange="UploadLoad()">
                        </li>
                        <li style="display:none">
                            <a href="###" class="mod-li-icon"><img src="/View_Mobile/images/c-bj.png" height="188" width="188" alt=""></a>
                            <div class="mod-li-tip">新建笔记</div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <script src="/View_Mobile/JS/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm-extend.min.js' charset='utf-8'></script>
    <script src="/View_Mobile/JS/touch-tab.js"></script>
    <script src="/View_Mobile/JS/avalon.mobile.min.js"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>
        window.onload = init;
        function init() {
            var plus_btn = document.getElementById("plus_btn");
            var module_plus = document.getElementById("module_plus")
            plus_btn.onclick = function () { module_plus.style.display = "block" }
            module_plus.onclick = function () { module_plus.style.display = "none" }
        }
        var strId = ComFunJS.getQueryString("id");
        var strType = ComFunJS.getQueryString("type");


        window.localStorage.removeItem("page");
        window.localStorage.setItem("page", 1);

        window.localStorage.removeItem("isjz");
        window.localStorage.setItem("isjz", 0);

        var model = avalon.define({
            $id: "UI_QYWD_LISTN",
            wjjData: [],
            wjData: [],
            isback: "",
            urlData: [],
            wjjpath: "",
            no: "",
            isadd: "",
            type: "",
            mapPath: [],
            Name: ComFunJS.getQueryString("name"),//头部显示路径
            isQX: false,
            selWJ: [],
            SetMath: function () {
                if (!model.Name) {
                    model.Name = "企业知识库_1";
                    if (strId == "2") {
                        model.Name = "个人文档_2";
                    }
                    else if (strId == "0") {
                        model.Name = "我的收藏_0";
                    }
                    else if (strId == "4") {
                        model.Name = "共享文档_4";
                    }
                }
                if (model.Name) {
                    var html = "";
                    var name = "";
                    var paths = model.Name.split(',');
                    $(paths).each(function (index, ele) {
                        if (!name) { name = ele; }
                        else { name = name + "," + ele; }
                        var pathModel = { name: "", url: "" };
                        var wjj = ele.split('_');
                        pathModel.name = wjj[0];
                        pathModel.url = "UI_QYWD_LISTN.html?r=" + Math.random() + "&id=" + wjj[1] + "&type=" + strType + "&name=" + name;
                        model.mapPath.push(pathModel);
                    })
                }
            },
            fdtp: function (obj) {
                var str = $(obj).attr("urlid");
                if (!str) {

                    $(".mall_pcp").each(function (index, ele) {
                        if ($(ele).attr("img")) {
                            $(ele).attr("urlid", model.urlData.length);
                            model.urlData.push($(ele).attr("img"));
                        }
                    });
                    myPhotoBrowserCaptions = $.photoBrowser({
                        photos: model.urlData,
                        theme: 'dark'
                    });
                }

                myPhotoBrowserCaptions.open($(obj).attr("urlid") * 1);
            },
            vieww: function (el) {
                window.location = "UI_QYWD_LISTN.html?id=" + el.ID + "&name=" + model.Name + "," + el.Name + "_" + el.ID + "&type=" + strType + "&r=" + Math.random();
            },
            viewwxx: function () {
                if (model.selWJ.size() != 1) {
                    ComFunJS.winwarning("请选择一个文件！");
                    return;
                }
                if (ComFunJS.xstp(model.selWJ[0].FileExtendName)) {
                    model.fdtp($("#wj" + model.selWJ[0].ID));
                } else if (model.selWJ[0].YLUrl) {
                    window.location = model.selWJ[0].YLUrl;
                }
                if (model.selWJ[0].FileExtendName.toLowerCase() == "mp4") {
                    window.location = "/ViewV5/Base/showvideo.html?md5=" + model.selWJ[0].FileMD5;
                }

            }, DownLoadFile: function () {
                if (model.selWJ.size() != 1) {
                    ComFunJS.winwarning("请选择一个文件！");
                    return;
                }
                window.location = ComFunJS.getfile(model.selWJ[0].ID);

            }, WJYL: function (el) {
                if (el.ISYL == "Y" && el.YLUrl) {
                    window.location = el.YLUrl;
                }
            }, LoadMenu: function (el) {
                model.wjData.forEach(function (item) {
                    if (item.ID == el.ID) {
                        el.issel = !el.issel;
                    } else {
                        item.issel = false;
                    }
                })

                if (el.issel) {

                    model.selWJ.clear();
                    model.selWJ.push(el);
                    $(".click-show").show();
                    $(".bar-click-show").show();
                } else {
                    model.selWJ.clear();
                    $(".click-show").hide();
                    $(".bar-click-show").hide();
                }

            }, scwj: function () {
                if (model.type == '2' || (model.type == '1' && model.isadd == 'true')) {
                    $("#file").trigger("click");
                }
                else {
                    ComFunJS.winwarning("您没有上传权限！");
                }
            }, hideheader: function () {
                $(".click-show").hide();
                $(".bar-click-show").hide();
                model.wjData.forEach(function (item) {
                    item.issel = false;
                })

            }, DelFile: function () {
                if (model.selWJ.size() == 0) {
                    ComFunJS.winwarning("请选择要删除的文件");
                    return;
                }
                var delmodel = model.selWJ.$model;
                var flag = false;
                model.selWJ.forEach(function (wjitem) {
                    if (wjitem.type == "file")
                    {
                        flag = true;
                    }
                })
                var msg = "";
                if (flag)
                {
                    msg = "如果删除目录会删除目录下的所有文件,";
                }
                $.confirm(msg + "确认要删除选中项吗", function () {
                    $.post('/API/VIEWAPI.ashx?Action=QYWD_DELFLODER', {
                        P1: JSON.stringify(delmodel)
                    }, function (resultData) {//P1为个人文件夹
                        var resultData = $.parseJSON(resultData);
                        if (resultData.ErrorMsg == "") {
                            ComFunJS.winsuccess("删除成功");
                            model.wjData.remove(model.selWJ[0])
                        } else {

                        }
                    })
                })
            }, ShareWJ: function () {
                if (model.selWJ) {
                    var type = model.selWJ[0].FileExtendName ? "file" : "wj";
                    $.post('/API/VIEWAPI.ashx?Action=QYWD_ADDSHARECODE', {
                        "P1": model.selWJ[0].ID, "P2": type, url: "http://" + location.host + "/ViewV5/share.html"
                    }, function (result) {
                        var result = $.parseJSON(result);
                        if (result.ErrorMsg == "") {
                            location.href = "UI_QYWD_Share.html?shareid=" + result.Result.ID;
                        } else {

                            top.ComFunJS.winwarning("分享失败，请稍后重试");
                        }
                    })
                } else {
                    top.ComFunJS.winwarning("请选中要分享的文件");
                }
            },
        });

        function loadMore() {

            if (strType == "4" && strId == "4") {
                $.getJSON("/API/VIEWAPI.ashx?Action=QYWD_GETNBSHARELIST&r=" + Math.random(), function (r) {
                    if (r.ErrorMsg == "") {
                        model.wjjData.pushArray(r.Result);
                    }
                });
            }
            else {
                $.getJSON("/API/VIEWAPI.ashx?Action=QYWD_GETLISTDATA&r=" + Math.random(), { P1: strId == "0" ? "" : strId, itemtype: strType }, function (r) {

                    if (r.ErrorMsg == "") {
                        r.Result.forEach(function (item) {
                            item.type = "wjj";
                            item.issel = false;
                        })
                        r.Result1.forEach(function (item) {
                            item.type = "file";
                            item.issel = false;
                        })
                        model.wjjData.pushArray(r.Result);
                        model.wjData.pushArray(r.Result1);
                        if (model.wjjData.length == 0 && model.wjData.length == 0) {
                            model.no = "Y";
                        }
                        if (r.Result2) {
                            model.isadd = r.Result2;
                        }
                    }
                })

            }
        }

        var myPhotoBrowserCaptions;

        avalon.ready(function () {
            if (!strId) {
                strId = "1";
                strType = "1";
            }
            else {
                if (strId == "1" || strId == "2" || strId == "0") {
                    model.isback = "";
                }
                else {
                    model.isback = "Y";
                }
            }
            model.SetMath();

            $(".tab-item").removeClass("active");
            $(".tab-item").eq(strType * 1 - 1).addClass("active");

            model.type = strType;

            loadMore();
        })
       
        function UploadLoad() {
            var str = strId;
            if (document.getElementById("file").files.length > 0) {
                var formData = new FormData();
                formData.append("upFile", document.getElementById("file").files[0]);
                $.ajax({
                    url: "/API/VIEWAPI.ashx?ACTION=XTGL_UPLOADFILES&P1=" + str + "&r=" + Math.random(),
                    type: "POST",
                    data: formData,
                    /**
                    *必须false才会自动加上正确的Content-Type
                    */
                    contentType: false,
                    /**
                    * 必须false才会避开jQuery对 formdata 的默认处理
                    * XMLHttpRequest会对 formdata 进行正确的处理
                    */
                    processData: false,
                    success: function (result) {
                        var r = $.parseJSON(result);
                        if (r.ErrorMsg == "") {
                            document.getElementById("file").outerHTML = document.getElementById("file").outerHTML;
                            $("#file").change(function () {
                                UploadLoad(str);
                            });
                            if (r.Result1.length == 0) {
                                r.Result.forEach(function (item) {
                                    item.issel = false;
                                    item.type = "file";
                                })
                                model.wjData.push(r.Result[0]);
                            }
                            ComFunJS.winsuccess("上传成功！");
                        }
                    }
                });
            }
        }
    </script>
</body>

</html>
